package qiurank;

import java.util.List;

/**
 * Created by Administrator on 2016/1/14.
 */
public abstract  class UrlManageFather extends Object{
    protected List<UrlObject> noUrl;
    public PlanInterface plan;
    public UrlManageFather(){
        try {
            plan=(PlanInterface)Class.forName("app."+Config.getValue("package")+".Filter").getConstructors()[0].newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        setNoUrlList();
    }

    protected boolean isExist(UrlObject urlObject){
        for(UrlObject ul:noUrl){
            if(urlObject.key==ul.key&&urlObject.url.equals(ul.url)){
                return true;
            }
        }
        return  false;
    }
    /**
     * 获得未爬取url列表
     * @return 未爬取url列表
     */
    public List<UrlObject> getNoUrlList(){
        return noUrl;
    }
    public abstract int getYesUrlCount();
    protected abstract void setNoUrlList();
    public boolean setNoPa(UrlObject urlObject){
        if(urlObject!=null) {

        }
        Log.show("要将:"+urlObject.url+"变成待爬取--失败");
        return  false;
    }
    public abstract boolean addUrl(String url,int weight);
}
